package priv.stones.io.Scanner.file;

import java.io.*;
import java.util.Scanner;

/**
 * @Author: Stones
 * @Description:打印流
 * @Date: 2017/11/1 11:52
 */
public class PrintStream1 {

    public static void main(String[] args) throws IOException {
//        PrintStream printStream = new PrintStream(new FileOutputStream("e:\\hulei.txt"));
//        printStream.print("胡磊 测试一下你");
//        printStream.close();
//        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("e:\\1.txt"))));


//        BufferedReader br = new BufferedReader(new FileReader(new File("e:\\1.txt")));
//        while (true) {
//            String str = br.readLine();
//            if(str==null){
//                System.out.println("没有了");
//                break;
//            }
//            System.out.println(str);
//        }

        Scanner scanner = new Scanner(new FileInputStream(new File("e:\\1.txt")));
        scanner.useDelimiter("\r\n");
        while (scanner.hasNext()) {
            String str = scanner.next();
            System.out.print(str);
        }
        scanner.close();
//        while (true) {
//            String str = scanner.next();
//            if (str.equals("exit")) {
//                break;
//            }
//            System.out.println(str);
//        }


    }

}
